<template>
  <div>
    <el-select
      v-model="value"
      :multiple="false"
      collapse-tags
      style="width: 100%"
      @change="handleChange"
      :placeholder="$t('labels.pleaseSelect')"
    >
      <el-option
        v-for="item in datas"
        :key="item.code"
        :label="item.name"
        :value="item.code"
      >
      </el-option>
    </el-select>
  </div>
</template>
<script>
export default {
  data() {
    return {
      datas: [],
      value: "",
    };
  },
  model: {
    prop: "code",
    event: "innerChange",
  },
  methods: {
    getData() {
      this.datas = [
        {
          code: "journal",
          name: "凭证",
        },
      ];
    },
    handleChange() {
      this.$emit("innerChange", this.value);
    },
  },
  watch: {
    code: {
      handler(value) {
        this.value = value;
      },
    },
  },
  mounted() {
    this.value = this.id;
    this.getData();
  },
  props: {
    code: {
      type: String,
    },
  },
};
</script>
